home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 4 / The Arsenal Files 4 (Arsenal Computer).ISO / telecomm / freecomm.exe / LEARNMCI.HP < prev    next >
Encoding:
Text File  |  1992-11-20  |  4.3 KB  |  182 lines

  1. ;    $Revision:   2.0  $
  2. ;    $Date:   20 Nov 1992 10:52:32  $
  3. ;
  4.     declare string ID, Password, Result, Remainder, Original
  5.     declare string Key, KeysPressed, LogonFileName, OneChar
  6.     declare integer Len, Idx, Attempt
  7.  
  8.     wait seconds(1)
  9. Loop:
  10.     type("<ENTER>")
  11.     ifnot wait text("e:", 5)
  12.         add(Attempt, 1)
  13.         if equal(Attempt, 4) goto LogonFailed
  14.         goto Loop
  15.     endif
  16.     cursor save()
  17.     gosub GetLogonInfo
  18.     cursor restore()
  19.     type("/(ID)<ENTER>")
  20.     ifnot wait prompt("d:  ", 60) goto LogonFailed
  21.     type("/(Password)<ENTER>")
  22.     ifnot wait prompt("nd: ", 30) greater(2,1)
  23.     gosub WriteNewScript
  24.     truncate(LogonFileName, ".")
  25.     type("<ALT-M>dm<ENTER>L/(LogonFileName)<ENTER><ALT-C>")
  26.     gosub PostNote
  27.     end()
  28.  
  29. WriteNewScript:
  30.     set string(Original, ID)
  31.     gosub SlashCheck
  32.     set string(ID, Result)
  33.     set string(Original, Password)
  34.     gosub SlashCheck
  35.     set string(Password, Result)
  36.     unique filename(LogonFileName, "mcilogon.hp")
  37.     write to(LogonFileName)
  38.     write("set integer(I(0),0)")
  39.     write("wait tenths(15)")
  40.     write("Loop:")
  41.     write("type(/"<ENTER>/")")
  42.     write("ifnot wait text(/"e:/", 5)")
  43.     write("add (I(0),1)")
  44.     write("if equal(I(0),4)")
  45.     write("prompt(/"Logon script failed./")")
  46.     write("hangup()")
  47.     write("end()")
  48.     write("endif")
  49.     write("goto Loop")
  50.     write("endif")
  51.     write("type(/"/(ID)<ENTER>/")")
  52.     write("wait prompt(/"d:  /", 30)")
  53.     write("type(/"/(Password)<ENTER>/")")
  54.     write("end()")
  55.     write to("")
  56.     return()
  57.  
  58. GetLogonInfo:
  59.     set string(ID, "∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙")
  60.     set string(Password, "∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙")
  61.     option("use menu colors", yes)
  62.     option("bold", yes)
  63.     position(6,12)
  64.     save screen(8,59)
  65.     draw box(8, 59)
  66.     position(13, 33)
  67.     prompt(" ESC to cancel ")
  68.     option("bold", no)
  69.     position(7, 14)
  70.     prompt("Enter your MCI account information below.  The")
  71.     position(8, 14)
  72.     prompt("The LEARNMCI script will create a logon script for you.")
  73.     position(10, 18)
  74.     prompt("MCI user name:")
  75.     position(11, 18)
  76.     prompt("MCI Password:")
  77.     option("bold",yes)
  78.     position(10,33)
  79.     key edit(ID,18)
  80.     if string match(ID, "∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙") goto EscExit
  81.     position(11,32)
  82.     key edit(Password, 18)
  83.     if string match(Password, "∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙") goto EscExit
  84.     option("use menu colors", no)
  85.     option("bold", no)
  86.     position(5,12)
  87.     restore screen()
  88.     return()
  89.  
  90. EscExit:
  91.     option("use menu colors", no)
  92.     option("bold", no)
  93.     restore screen()
  94.     cursor restore()
  95.     hangup()
  96.     end()
  97.  
  98. SlashCheck:
  99.     set string(Result, "")
  100.     set string(Remainder, Original)
  101.     set integer(Idx, 1)
  102.     ifnot length(Original, Len) return()
  103. SlashLoop:
  104.     set string(OneChar, Remainder)
  105.     left(OneChar, 1)
  106.     if string match(OneChar, "//")
  107.         set string(Result, "/(Result)////")
  108.     else
  109.         set string(Result, "/(Result)/(OneChar)")
  110.     endif
  111.     ifnot cut(Remainder, OneChar)
  112.         set string(Result, Original)
  113.         return()
  114.     endif
  115.     add(idx, 1)
  116.     if greater(Idx, Len) 
  117.         return()
  118.     else
  119.         goto SlashLoop
  120.     endif
  121.  
  122. PostNote:
  123.     cursor save()
  124.     uppercase(LogonFileName, LogonFileName)
  125.     option("use menu colors", yes)
  126.     option("bold", yes)
  127.     position(6,12)
  128.     save screen(9,59)
  129.     draw box(9, 59)
  130.     position(14, 33)
  131.     prompt(" ESC to continue ")
  132.     option("bold", no)
  133.     position(7, 14)
  134.     prompt("The LEARNMCI script has saved your new logon script")
  135.     position(8, 14)
  136.     prompt("under the name /(LogonFileName).  The next time you call,")
  137.     position(9,14)
  138.     prompt("the /(LogonFileName) script will log on for you.")
  139.     position(11,14)
  140.     prompt("You can have HA//5 learn more powerful logon scripts")
  141.     position(12,14)
  142.     prompt("than this by using the method on page 43 of the manual.")
  143.     position(14,34)
  144. PostLoop:
  145.     ifnot wait key(Key) goto PostLoop
  146.     ifnot string match(Key, "<ESC>")
  147.         prompt("/x07")
  148.         goto PostLoop
  149.     endif
  150.     option("use menu colors", no)
  151.     restore screen()
  152.     cursor restore()
  153.     return()
  154.  
  155. LogonFailed:
  156.     cursor save()
  157.     option("use menu colors", yes)
  158.     option("bold", yes)
  159.     position(5,12)
  160.     save screen(8,51)
  161.     draw box(8, 51)
  162.     option("bold",no)
  163.     position(7, 14)
  164.     prompt("The logon attempt failed.  Maybe the line was")
  165.     position(8, 14)
  166.     prompt("noisy or the account information was incorrect.")
  167.     position(10,20)
  168.     option("bold",yes)
  169.     prompt("Press ESC to resume manual control")
  170.     position(10,19)
  171.     option("bold",no)
  172. FailedLoop:
  173.     ifnot wait key(Key) goto PostLoop
  174.     ifnot string match(Key, "<ESC>")
  175.         prompt("/x07")
  176.         goto FailedLoop
  177.     endif
  178.     option("use menu colors", no)
  179.     restore screen()
  180.     cursor restore()
  181.     end()
  182.